<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@taglib prefix="auth" uri="http://www.wfk.com/auth"%>
<%@taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/static/h-ui.admin/css/style.css" />
<!-- 编辑器 -->
<script type="text/javascript" charset="utf-8" src="/neditor/neditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/neditor/neditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/neditor/neditor.service.js"></script>
<script type="text/javascript" charset="utf-8" src="/neditor/i18n/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/neditor/third-party/browser-md5-file.min.js"></script>
<script type="text/javascript" src="/neditor/third-party/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="/static/mjs/neditor.js"></script>
<title>商品管理</title>
</head>
<body>
<div class="page-container">
	<form  id="myForm" class="form form-horizontal" method="post">
		 <input type="hidden" name="loginId" value="${loginId}"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>产品标题：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${vo.title}" name="title">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">产品编号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${vo.goodsCode}" name="goodsCode" style="width:25%">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>规格：</label>
			<div class="formControls col-xs-8 col-sm-9">
			 <span class="select-box">
				<select class="select" name="specid">
					<c:forEach items="${specs}" var="m">
						<option value="${m.id}" <c:if test="${m.id==vo.specid}">selected="selected"</c:if>>${m.name}</option>
					</c:forEach>
				</select>
				</span> 
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>服务：</label>
			<div class="formControls col-xs-8 col-sm-9">
			 <span class="select-box">
				<select class="select" name="serviceId">
					<c:forEach items="${serviceList}" var="m">
						<option value="${m.id}" <c:if test="${m.id==vo.serviceId}">selected="selected"</c:if>>${m.name}</option>
					</c:forEach>
				</select>
			</span> 
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
			 <span class="select-box">
				<select class="select" name="type">
						<option value="0" <c:if test="${vo.type==0}">selected="selected"</c:if>>扫描机</option>
						<option value="1" <c:if test="${vo.type==1}">selected="selected"</c:if>>体验机</option>
				</select>
			</span> 
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">市场价格：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" name="price" placeholder="" value="${vo.price}" class="input-text" style="width:90%">
				元</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">每天收益：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" name="dayProfit"  placeholder="" value="${vo.dayProfit}" class="input-text" style="width:90%">
				元</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">扫描天数：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" name="scanDay"  placeholder="" value="${vo.scanDay}" class="input-text" style="width:90%">
				元</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">封面图：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="uploader-thum-container">
					<input type="file" name="pfile" class="input-text" style="width:20%">
					<input type="hidden" name="purl" value="${vo.purl}" class="input-text" style="width:20%">
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">图片：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<div class="uploader-thum-container">
					图片一:<input type="file" name="ufile"   class="input-text" style="width:20%"><br>
					图片二:<input type="file" name="ufile"   class="input-text" style="width:20%"><br>
					图片三:<input type="file" name="ufile"   class="input-text" style="width:20%"><br>
					图片四:<input type="file" name="ufile"   class="input-text" style="width:20%"><br>
					图片五:<input type="file" name="ufile"   class="input-text" style="width:20%"><br>
					图片合集：<input type="text" name="url" 	value="${vo.url}" class="input-text" style="width:20%" />
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">图文详情：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<script id="editor" type="text/plain" style="width:1024px;height:500px;">${vo.imgDetail}</script>
				<textarea type="text" id="imgDetail" name="imgDetail" class="textarea" style="display:none;">${vo.imgDetail}</textarea>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">商品参数：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<script id="editor2" type="text/plain" style="width:1024px;height:500px;">${vo.goodsDetail}</script>
				<textarea type="text" id="goodsDetail"  name="goodsDetail" class="textarea" style="display:none;">${vo.goodsDetail}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onClick="adminStart();" class="btn btn-primary radius" type="button" ><i class="Hui-iconfont">&#xe632;</i> 保存并提交审核</button>
			</div>
		</div>
	</form>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var loginId = "${loginId}" ;
var ue2 = UE.getEditor('editor2');
/*管理员-增加*/
function admin_add(title,url,w,h){
	layer_show(title,url,w,h);
}

/*管理员-启用*/
function adminStart(){
	var arr = [];
	arr.push(UE.getEditor('editor').getContent());
	var arr2 = [];
	arr2.push(UE.getEditor('editor2').getContent());
	$("#imgDetail").val(arr.join('\n'));
	$("#goodsDetail").val(arr2.join('\n'));
	layer.confirm("你确定要保存？",function(index){
		//此处请求后台程序，下方是成功后的前台处理……
		$("#myForm").ajaxSubmit({
			url:"/goods/goodsEdit",
			type:"post",
			dataType:"json", //ajax一定要加上这个，不然的话，会认为后端是返回一个字符串
			data:$("#myForm").serialize(),
			success:function(data){
				if(data.code == 200){
					layer.msg('更改成功!', {icon: 6,time:1000});
					window.location="/goods/goodsList?loginId="+loginId;
				}else{
					layer.msg(data.message,{icon: 2,time:1000});
				}
			},
			error:function(data) {
				layer.msg('error!',{icon:2,time:1000});
			}
		})
	});
}

</script>
</body>
</html>